/**
  * @file   DataType.h
  * @author Djuro Drljaca (djurodrljaca@gmail.com)
  * @date   2014-04-18
  * @brief  DON data type enum and it's supporting functions.
  *
  * Copyright 2014  Djuro Drljaca (djurodrljaca@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
  */

#ifndef DON_CORE_DATATYPES_DATATYPE_H
#define DON_CORE_DATATYPES_DATATYPE_H

#include <QtCore/qglobal.h>
#include <DON/Core/libdon-qt4-core_global.h>

namespace DON
{
namespace Core
{
namespace DataType
{

/**
  * Enumerates all data types
  */
enum DataType
{
    DataType_Invalid = -1,
    DataType_Boolean = 0,
    DataType_Int8 = 1,
    DataType_UInt8 = 2,
    DataType_Int16 = 3,
    DataType_UInt16 = 4,
    DataType_Int32 = 5,
    DataType_UInt32 = 6,
    DataType_Int64 = 7,
    DataType_UInt64 = 8,
    DataType_Float32 = 9,
    DataType_Float64 = 10,
    DataType_String = 11,
    DataType_Date = 12,
    DataType_Time = 13,
    DataType_Structure = 14,
    DataType_Array = 15,
    DataType_Custom = 16
};

/**
 * @brief Check if data type is valid
 * @param dataType Data type
 * @retval true Data mode is valid
 * @retval false Data mode is not valid
 */
LIBDONQT4CORESHARED_EXPORT bool isDataTypeValid(const DataType dataType);

/**
 * @brief Convert binary data to DataType value
 * @param data Binary data
 * @param ok Error status output (true --> success, false --> error)
 * @return DataType value
 */
LIBDONQT4CORESHARED_EXPORT DataType fromBinaryToDataType(const char data);

/**
 * @brief Convert DataType value to binary data
 * @param dataType DataType value
 * @param ok Error status output (true --> success, false --> error)
 * @return Binary data
 */
LIBDONQT4CORESHARED_EXPORT char fromDataTypeToBinary(const DataType dataType, bool *ok = NULL);

}
}
}

#endif // DON_CORE_DATATYPES_DATATYPE_H
